/*
 * com.workhard.webapp.login.SecurityInterceptor.java		1.00	Mar 28, 2008
 * CREATE		Guoyou Jiang
 *
 * Alteration Records:
 * Create file at:	Mar 28, 2008   3:00:14 PM
 *
 */
package com.workhard.webapp;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class SecurityInterceptor implements Interceptor {

    private static final long serialVersionUID = 1L;

    public void destroy() {
    }

    public void init() {
    }

    @SuppressWarnings("unchecked")
    public String intercept(ActionInvocation invocation) throws Exception {
        Map session = invocation.getInvocationContext().getSession();
        
        if(!session.containsKey(Constants.SESSION_USER)){
            return "loginFailure";
        }else{
            return invocation.invoke();
        }
        
    }

}
